package cn.flant.cmd;

import java.net.InetAddress;
import java.util.Date;

import cn.flant.io.tcp.SocketContext;

public class Request extends ParamContent {
	private CommandSocketHandler handler;
	private String sourceRequest;
	private Date requestTime;
	private String requestName;
	private InetAddress remoteAddress;
	private int remotePort;
	private InetAddress localAddress;
	private int localPort;

	public Request() {
		this.requestTime = new Date();
	}

	protected void setHandler(CommandSocketHandler handler) {
		this.handler = handler;
	}

	public String getSourceRequest() {
		return sourceRequest;
	}

	protected void setSourceRequest(String sourceRequest) {
		this.sourceRequest = sourceRequest;
	}

	public Date getRequestTime() {
		return requestTime;
	}

	public String getRequestName() {
		return requestName;
	}

	protected void setRequestName(String requestName) {
		this.requestName = requestName;
	}

	public InetAddress getRemoteAddress() {
		return remoteAddress;
	}

	protected void setRemoteAddress(InetAddress remoteAddress) {
		this.remoteAddress = remoteAddress;
	}

	public int getRemotePort() {
		return remotePort;
	}

	protected void setRemotePort(int remotePort) {
		this.remotePort = remotePort;
	}

	public InetAddress getLocalAddress() {
		return localAddress;
	}

	protected void setLocalAddress(InetAddress localAddress) {
		this.localAddress = localAddress;
	}

	public int getLocalPort() {
		return localPort;
	}

	protected void setLocalPort(int localPort) {
		this.localPort = localPort;
	}

	public Object read(long timeout) {
		return handler.read(timeout);
	}

	public SocketContext getSocketContext() {
		return handler.getSocketContext();
	}

}
